package biz.datalk.industrialland.common.result;


/**
 * @author tarofang@163.com
 * @date 2019年03月21日
 */
@SuppressWarnings({"unused", "WeakerAccess"})
public class UnifyResultUtil {

    public static boolean isFail(UnifyResult result) {
        return !isSuccess(result);
    }

    public static boolean isSuccess(UnifyResult result) {
        return UnifyResultCode.SUCCESS.equals(result.getRsCode());
    }

    public static <T> T getData(UnifyResult result, Class<T> clazz) {
        Object o = result.getData();
        T t = clazz.cast(o);
        result.setData(null);
        return t;
    }
}
